package com.day0930;

import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;

public class MainText2 {
    public static void main(String[] args) {
        NewsManager newsManager = new NewsManager("李易峰糊了","1","朝阳群众");
        NewsManager newsManager1 = new NewsManager("李云迪糊了","2","朝阳群众");
        NewsManager newsManager2 = new NewsManager("吴亦凡糊了","3","朝阳群众");
        NewsManager newsManager3 = new NewsManager("罗志祥糊了","4","朝阳群众");
        //  List  接口  有序  不唯一
        //ArrayList arrayList = new ArrayList();
        //   多态 创建集合   ArrayList多态  LinkedList  不用多态
//        泛型<>
        LinkedList<NewsManager> linkedList = new LinkedList<>();
        linkedList.add(newsManager);
        linkedList.add(newsManager1);
        linkedList.add(newsManager2);
        linkedList.add(newsManager3);
        //  遍历 第一种
        for (int i = 0; i < linkedList.size(); i++) {
            NewsManager manager =  linkedList.get(i);//   取值  get()
//            Object object =  arrayList.get(i);//   取值  get()
//            NewsManager manager = (NewsManager)object;
            System.out.println(manager);
        }

    }
}
